﻿/**********************************天使物流*******************************************
* 功能描述:登录
* 作者:孟帅龙
* 时间:2022/1/10
* 
**********************************天使物流*******************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TianShiProject.EntityFrameworkCore;
using TianShiProject.Models.Common;
using TianShiProject.Models.System.Logins;
using TianShiProject.Models.System.Operators;
using Volo.Abp.EntityFrameworkCore;

namespace TianShiProject.System.Logins
{
    public class DengLuRepository : DapperDbContextRepository, IDengLuRepository
    {
        public DengLuRepository(IDbContextProvider<TianShiProjectDbContext> dbContextProvider) : base(dbContextProvider)
        {
        }

        #region 登录
        /// <summary>
        /// 登录
        /// </summary>
        /// <param name="dengLuDto"></param>
        /// <returns></returns>
        public async Task<ResponseModel<DengLuDto>> PostDengLu(DengLuDto dengLuDto)
        {
            ResponseModel<DengLuDto> response = new ResponseModel<DengLuDto>();

            var sql = $"select Id,Account,Password from Operator where Account='{dengLuDto.Account}' and Password='{dengLuDto.Password}'";
            var arr = await this.QueryAsync<DengLuDto>(sql);
            response.Data = arr.FirstOrDefault();
            return response;
        } 
        #endregion
    }
}
